package com.xyy.saas.payment.adpater.abchinaLoan.core.req;

import com.xyy.saas.payment.common.exception.PayBizException;
import com.xyy.saas.payment.cores.enums.ResultCodeEnum;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;

/**
 * @author wangzeqi
 */
@Data
@Accessors(chain = true)
public class OrderCheckDto {

    /**
     * 订单号
     */
    private String orderId;

    /**
     * 企业统一信用代码
     */
    private String uscc;

    /**
     * 订单金额
     */
    private BigDecimal orderAmt;

    /**
     * 受托支付账号标识
     */
    private String entrustedAcc;

    public static OrderCheckDto mock() {
        return new OrderCheckDto()
                .setUscc("91510100MA64QPET84")
                .setOrderId("1")
                .setOrderAmt(new BigDecimal("666.66"))
                .setEntrustedAcc("acc1");
    }

    public void checkParam() {
        if (StringUtils.isBlank(orderId) || StringUtils.isBlank(uscc) || orderAmt == null || StringUtils.isBlank(entrustedAcc)) {
            throw new PayBizException(ResultCodeEnum.PARAM_ERROR);
        }
    }

}
